<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link href="/static/thinkct/css/basic.css?v=1" rel="stylesheet" type="text/css" /><script language="javascript" src="/static/thinkct/js/jquery.m.js"></script><script language="javascript" src="/static/thinkct/js/layui/layui.js"></script><script language="javascript" src="/static/thinkct/js/common.js?v=1"></script><script language="javascript" src="/static/thinkct/js/member.js?v=1"></script><link href="/static/thinkct/css/member.css?v=1" rel="stylesheet" type="text/css" /><link href="/static/thinkct/js/layui/css/layui.css" rel="stylesheet" type="text/css" /><style>
.control{padding-top:3px}
.layui-form-radio i {
    font-size: 18px;
	margin:0;
}
.layui-form-radio {
    padding-right: 0;
	margin-right:0;
	line-height: 16px;
}
</style>
</head>
<body>
<div class="layui-form">
<table class="tablelist">



       <thead>    	
        <tr>
		<td width="3%"></td>
		<td>商品</td>
        <td width="10%">售价</td>
        <td width="30%">分类</td>
        </tr>
       </thead>
       <tbody>
		{foreach $data as $v}<tr>
			<td><input name="C1" type="radio" title=" " value="{$v.bh}"  data_id={$v.id}></td>
			<td style='padding-left:0'><a href="{:c_url($v.id,'code')}" target='_blank'>{:title($v.tit)}</a></td>
			<td style="color:#f60;font-weight:700;">￥{$v.money}</td>
			<td>PHP <font color=#dddddd>|</font> Mysql <font color=#dddddd>|</font> 域名/空间/建站 <font color=#dddddd>|</font> 其他</td>
			</tr>{/foreach}	   
		{if !$data}<tr><td colspan=4>没有内容！</td></tr>{/if}</tbody>
</table>
<div class="control">

 <div class="batchs">
 
	<button class="layui-btn" lay-submit lay-filter='Import'>导入选中</button>
	<div class="layui-input-inline" style="margin-left:10px;width:95px;">
		<input data="key" id='key' class="layui-input" placeholder="搜索关键词" value="{:input('key')}" maxlength="20" type="text">
	</div>
	<input type="button" onclick="preso()" value="搜索" class="layui-btn layui-btn-primary" />
</div>

	<div class="upage">{分页}</div>
</div>
</div>
<script>
var index = parent.layer.getFrameIndex(window.name);
layui.use('form', function(){
 form = layui.form();
form.on('submit(Import)', function(data){
	if($("input[name='C1']:checked").length==0){
		parent.layer.alert("至少选择<b class='red'>1</b>个导入！",{icon:0});return false;
	}
			var obj=$("input[name='C1']:checked");
		parent.$('.commend_object').html(obj.closest("tr").find("td").eq(1).html().replace('red',''));
		parent.$('input[name=gid]').val(obj.attr('data_id'));
		parent.layer.close(index);
		return false;
		var max=20,err=0,suc=0;
	$("input[name='C1']:checked").each(function(){ //由于复选框一般选中的是多个,所以可以循环输出 
	var Dnum=parent.$(".tablelist:eq(0) tbody tr").length,$this=$(this).closest("tr");
		if(Dnum>=max || parent.$(".tablelist:eq(0) tbody tr[datas='"+$(this).val()+"']").length>0){
			err++;
		}else{
			parent.$(".tablelist:eq(0) tbody").append("<tr datas='"+$(this).val()+"'><td class=tleft>"+$this.find("td").eq(1).html()+"</td><td  style=\"color:#f60;font-weight:700;\">"+$this.find("td").eq(2).html()+"</td><td><a class='remove'>移除</a></td></tr>");
			suc++;
		}
	}); 
	if(suc>0){
		parent.$('.trtisp').remove();
		parent.$('.tablelist:eq(0) tbody tr:odd').addClass('odd');
	}
	var oknum=(max-parent.$(".tablelist:eq(0) tbody tr:not([class=trtisp])").length);
	if(err>0){
		var tips=(parent.$(".tablelist:eq(0) tbody tr").length>=20)?"导入失败 <b class='red'>"+err+"</b> 个，已超过上限 <b class='blue'>"+max+"</b> 个或对象已存在！":"导入失败 <b class='red'>"+err+"</b> 个，对象已存在！";
		var icon=2;
	}else if(suc>0){
		var tips="导入成功 <b class='green'>"+suc+"</b> 个，还可导入 <b class='blue'>"+oknum+"</b> 个";
		var icon=1;
		parent.upnumber();
	}
	if(oknum<=0){
		parent.layer.msg(tips,{icon:icon,time: 5000});parent.layer.close(index);return false;
	}
	parent.layer.confirm(tips, {
	  btn: ['结束返回','继续选择'], //按钮
	  icon:icon
	}, function(){
		parent.layer.closeAll();
	}, function(index){
		layer.close(index);
	});
});    

})
parent.layer.title('<font color=blue>我的源码</font>', index);
</script>
 <script>
function preso(){
	var array=window.location.pathname.split("/"),p=$.inArray("page", array);
	if(p>0) array.splice(p,2);
	var val=$.trim($('#key').val()),i=$.inArray('key', array);
	if(val==''){
		if(i>0) array.splice(i,2);
	}else if(i>0){
		array[i+1]=val;
	}else{
		array.push('key',val);
	}
	array = $.grep(array, function(s){return s.length>0;});
	$url=array.join("/");
	location.href="/"+$url;
}
 </script>
 </body>
</html>